#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

    edit_row=new QLineEdit(this);
    edit_col=new QLineEdit(this);
    edit_mine=new QLineEdit(this);

    edit_row->move(150,70);
    edit_col->move(150,30);
    edit_mine->move(150,110);

    label_row=new QLabel("row:",this);
    label_col=new QLabel("col:",this);
    label_mine=new QLabel("mine:",this);

    label_row->move(100,70);
    label_col->move(100,30);
    label_mine->move(100,110);

    up=new QPushButton("Start!",this);
    up->move(150,150);
    connect(up,&QPushButton::clicked,this,&Dialog::up_all);
}

void Dialog::setRows(int rows)
{
    this->rows=rows;
}

void Dialog::setCols(int cols)
{
    this->cols=cols;
}

void Dialog::setMine(int mine)
{
    this->mine=mine;
}

int Dialog::getRows()
{
    return rows;
}

int Dialog::getCols()
{
    return cols;
}

int Dialog::getMine()
{
    return mine;
}

void Dialog::up_all()
{
    rows=edit_row->text().toInt();
    cols=edit_col->text().toInt();
    mine=edit_mine->text().toInt();

    emit(dia_test());

    this->close();
}

Dialog::~Dialog()
{
    delete ui;
}
